package com.cskaoyan.controller;

import com.cskaoyan.bean.common.BaseRespVo;
import com.cskaoyan.bean.vo.WxTopicDetailVo;
import com.cskaoyan.bean.vo.WxTopicListVo;
import com.cskaoyan.bean.vo.WxTopicRelatedVo;
import com.cskaoyan.service.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Trellis
 * @since 2022/09/09 10:50
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService wxTopicService;

    @RequestMapping("list")
    public BaseRespVo list(Integer page, Integer limit) {
        WxTopicListVo wxTopicListVo = wxTopicService.selectListByLimit(page, limit);
        BaseRespVo baseRespVo = BaseRespVo.ok(wxTopicListVo);
        return baseRespVo;
    }

    @RequestMapping("detail")
    public BaseRespVo detail(Integer id) {
        WxTopicDetailVo wxTopicDetailVo = wxTopicService.selectDetailById(id);
        BaseRespVo baseRespVo = BaseRespVo.ok(wxTopicDetailVo);
        return baseRespVo;
    }

    @RequestMapping("related")
    public BaseRespVo related(Integer id) {
        WxTopicRelatedVo wxTopicRelatedVo = wxTopicService.selectRelatedById(id);
        BaseRespVo baseRespVo = BaseRespVo.ok(wxTopicRelatedVo);
        return baseRespVo;
    }
}
